<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>{$meta_title}-狂雨小说CMS</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="__ADMIN__/css/admin.css"></head>
<body>
  <div class="layui-card layui-card-open">
    <div class="layui-card-body">
      <form class="layui-form" lay-filter="novel" action="{:url()}">
        <div class="layui-form-item">
          <label class="layui-form-label">名称</label>
          <div class="layui-input-block w500">
            <input type="text" name="title" lay-verify="required" class="layui-input" value="{$info.title|default=''}">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">栏目</label>
          <div class="layui-input-inline">
            <select name="category">
                <option value="">所有栏目</option>
                {volist name="category" id="vo"}
                    <option value="{$vo['id']}" {eq name="info.category|default=''" value="$vo['id']"}selected="selected"{/eq}>{$vo.html}{$vo.title}</option>
                {/volist}
            </select>
          </div>
          <label class="layui-form-label">连载</label>
          <div class="layui-input-inline">
            <select name="serialize">
              <option value="0" {eq name="info.serialize|default='0'" value="0"}selected="selected"{/eq}>连载中</option>
              <option value="1" {eq name="info.serialize|default=''" value="1"}selected="selected"{/eq}>已完结</option>
            </select>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">作者</label>
          <div class="layui-input-inline w500">
            <input type="text" name="author" class="layui-input" value="{$info.author|default=''}">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">封面</label>
          <div class="layui-input-inline w500">
            <div class="input-group">
              <input type="text" style="width:408px;" name="pic" value="{$info.pic|default=''}" class="layui-input">
              <button class="layui-btn" id="upload" type="button">上传封面</button>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">推荐</label>
          <div class="layui-input-block">
            {php}$position=empty($info['position'])?0:$info['position'];{/php}
            {volist name="Think.config.web.document_position" id="pos"}
              <input type="checkbox" value="{$key}" name="position[]" {if check_document_position($position,$key)}checked="checked"{/if} title="{$pos}">
            {/volist}
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">标签</label>
          <div class="layui-input-inline w500">
            <input type="text" name="tag" class="layui-input" value="{$info.tag|default=''}">
            <div class="layui-form-mid layui-word-aux">每一个标签使用,分割开</div>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">介绍</label>
          <div class="layui-input-block">
            <textarea name="content" class="layui-textarea">{$info.content|default=''}</textarea>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">顶</label>
          <div class="layui-input-inline">
            <input type="text" name="up" class="layui-input" value="{$info.up|default=0}">
          </div>
          <label class="layui-form-label">踩</label>
          <div class="layui-input-inline">
            <input type="text" name="down" class="layui-input" value="{$info.down|default=0}">
          </div>
          <div class="layui-input-inline">
            <a class="layui-btn" href="javascript:;" id="btn_rnd" title="随机生成">随机生成</a>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">日人气</label>
          <div class="layui-input-inline">
            <input type="text" name="hits_day" class="layui-input" value="{$info.hits_day|default=0}">
          </div>
          <label class="layui-form-label">周人气</label>
          <div class="layui-input-inline">
            <input type="text" name="hits_week" class="layui-input" value="{$info.hits_week|default=0}">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">月人气</label>
          <div class="layui-input-inline">
            <input type="text" name="hits_month" class="layui-input" value="{$info.hits_month|default=0}">
          </div>
          <label class="layui-form-label">总人气</label>
          <div class="layui-input-inline">
            <input type="text" name="hits" class="layui-input" value="{$info.hits|default=0}">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">总评分</label>
          <div class="layui-input-inline">
            <input type="text" name="rating" class="layui-input" value="{$info.rating|default=''}">
          </div>
          <label class="layui-form-label">总评次</label>
          <div class="layui-input-inline">
            <input type="text" name="rating_count" class="layui-input" value="{$info.rating_count|default=''}">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">推荐票</label>
          <div class="layui-input-inline">
            <input type="text" name="recommend" class="layui-input" value="{$info.recommend|default=0}">
          </div>
          <label class="layui-form-label">收藏</label>
          <div class="layui-input-inline">
            <input type="text" name="favorites" class="layui-input" value="{$info.favorites|default=0}">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">独立模版</label>
          <div class="layui-input-inline">
            <input type="text" name="template_index" class="layui-input" value="{$info.template_index|default=''}">
          </div>
          <div class="layui-input-inline">
            <a class="layui-btn" href="javascript:;" onclick="admin_show('选择模版','{:url('template/select_template',['input'=>'template_index'])}',600,400)" title="选择模版">选择模版</a>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">外链地址</label>
          <div class="layui-input-block">
            <input type="text" name="link" class="layui-input" value="{$info.link|default=''}">
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-input-block">
            <input name="id" type="hidden" value="{$info.id|default=""}" />
            <button class="layui-btn" lay-submit lay-filter="ajax" type="submit">提交</button>
          </div>
        </div>
      </form>
    </div>
  </div>
  <script type="text/javascript" src="__STATIC__/jquery/jquery.min.js"></script>
  <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js"></script>
  <script type="text/javascript" src="__ADMIN__/js/admin.js"></script>
  <script type="text/javascript">
    layui.use(['layer','upload','jquery'], function(){
      var layer = layui.layer;
      var upload = layui.upload;
      var inputTags = layui.inputTags;
      var uploadInst = upload.render({
        elem: '#upload' //绑定元素
        ,url: '{:url('upload/pic')}' //上传接口
        ,data: {path:'novel'}
        ,done: function(data){
          if(data.code){
            layer.msg(data.msg, {icon: 1,shade: 0.3,time: 2000},function(layero, index){
                $('[name="pic"]').val(data.data.path);
            });
          }else{
            layer.msg(data.msg, {icon: 0,shade: 0.3});
          }
        }
      });
    });
    $("#btn_rnd").click(function(){
        $('[name="up"]').val( rndNum(1,300) );
        $('[name="down"]').val( rndNum(1,300) );
        $('[name="hits_day"]').val( rndNum(1,300) );
        $('[name="hits_week"]').val( rndNum(300,1000) );
        $('[name="hits_month"]').val( rndNum(1000,5000) );
        $('[name="hits"]').val( rndNum(5000,9999) );
        $('[name="rating"]').val( rndNum(10) );
        $('[name="rating_count"]').val( rndNum(1,999) );
        $('[name="recommend"]').val( rndNum(1,999) );
        $('[name="favorites"]').val( rndNum(1,999) );
    });
  </script>
</body>
</html>